<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
        function b1Fun() {
            let elementsByTagName = document.getElementsByTagName("a");
            for (let i = 0; i < elementsByTagName.length; i++) {
                let elementsByTagNameElement = elementsByTagName[i];
                elementsByTagNameElement.href="https://www.baidu.com";
            }
        }
        function b2Fun() {
            let elementsByName = document.getElementsByName("one");
            for (let i = 0; i < elementsByName.length; i++) {
                let elementsByNameElement = elementsByName[i];
                elementsByNameElement.innerText="哈哈哈啊哈";
            }
        }
        function b3Fun() {
            let elementsByClassName = document.getElementsByClassName("two");
            for (let i = 0; i < elementsByClassName.length; i++) {
                let elementsByClassNameElement = elementsByClassName[i];
                elementsByClassNameElement.innerText="嘿嘿嘿";
            }
        }
    </script>
</head>
<body>
    <input type="button" value="(通过标签名)给a链接添加地址" onclick="b1Fun()"/>
    <input type="button" value="(通过name属性)给div设值" onclick="b2Fun()"/>
    <input type="button" value="(通过类名)给div设值" onclick="b3Fun()"/>
    <hr/>
    <a>传智播客</a><br/>
    <a>传智播客</a><br/>
    <a>传智播客</a><br/>
    <hr/>
    <div name="one"></div>
    <div name="one"></div>
    <div name="one"></div>
    <hr/>
    <div class="two"></div>
    <div class="two"></div>
    <div class="two"></div>
</body>
</html>